import typescript from "@rollup/plugin-typescript";
// import pkg from "./package.json";
import pkg from "./package.json" assert { type: "json" };

import resolve from "@rollup/plugin-typescript";
import commonjs from "@rollup/plugin-commonjs";

const footer = `
if(typeof window !== 'undefined') {
  window._rullup-ts_VERSION_ = '${pkg.version}'
}`;

export default {
  input: "./src/index.ts",
  output: [
    {
      file: pkg.main,
      format: "cjs",
      // footer,
    },
    {
      file: pkg.module,
      format: "esm",
      // footer,
    },
    {
      file: pkg.browser,
      format: "umd",
      name: "rullup-ts",
      // footer,
    },
  ],
  plugins: [typescript(), commonjs(), resolve()],
};
